import { reqAddressInfo ,reqOrderInfo} from "@/api"
const state = {
    address:[],
    orderInfo:{}
}
const mutations = {
    GETUSERADDRESS(state,address){
        state.address = address
    },
    GETORDERLIST(state,orderInfo){
        state.orderInfo = orderInfo
    }
}
const actions = {
   async getUserAddress({commit}){
       let result = await reqAddressInfo()
       if(result.code ==200){
        commit('GETUSERADDRESS')
       }
    },
    async getOrderList({commit}){
        let result = await reqOrderInfo()
        if(result.code ==200){
            commit('GETORDERLIST',result.data)
            return 'ok'
        }
    }
}
const getters = {}

export default{
    state,
    mutations,
    actions,
    getters,
}